package com.xcity.game.battle;

/**
 * 一次战斗环境，用于计算战斗过程中的伤害计算
 * @author yang.li
 *
 */
@Deprecated
public abstract class BattleContext {

	protected Battler source, target;
	
	public BattleContext(Battler source, Battler target) {
		this.source = source;
		this.target = target;
		source.init(this);
		target.init(this);
	}
	
	public <T extends Battler> T getSource() {
		return (T) source;
	}
	
	public <T extends Battler> T getTarget() {
		return (T) target;
	}
	
	/** 初始化战斗环境 */
	public abstract void init();
	/** 执行一次攻击计算(source->target) */
	public abstract void attack(Object param) throws BattleException;
	/** 执行一次防守计算(target->source) */
	public abstract void defense() throws BattleException;
	
}
